package cc.iotkit.manager.controller.miniApp;

import cc.iotkit.common.web.core.BaseController;
import cc.iotkit.manager.dto.bo.order.OrderBo;
import cc.iotkit.manager.service.IOrderService;
import cc.iotkit.model.system.SysOrder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"用户端订单管理"})
@Slf4j
@RestController
@RequestMapping("miniApp/order")
public class MiniAppOrderController extends BaseController {

    @Autowired
    private IOrderService orderService;
    /**
     * 添加设备分组
     */
    @ApiOperation(value = "借飞机")
    @PostMapping("/add")
    public void addOrder(@RequestBody OrderBo orderBo) {
        orderService.addOrder(orderBo);
    }

    @ApiOperation(value = "还飞机")
    @PostMapping("/updateOrder")
    public void updateOrder(@RequestBody OrderBo orderBo) {
        orderService.updateOrder(orderBo);
    }

    @GetMapping("/getOrderById")
    public SysOrder getOrderById(@RequestParam("id") Long id) {
        return orderService.getOrderById(id);
    }
}
